package com.banciyuan.bcywebview.biz.main.banner;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.banciyuan.bcywebview.R;
import com.banciyuan.bcywebview.base.helper.push.PushDataHelper;
import com.banciyuan.bcywebview.utils.universalimageloader.core.ImageLoader;
import com.banciyuan.bcywebview.utils.universalimageloader.utils.ImageOptions;
import com.bigkoo.convenientbanner.holder.Holder;

import de.greenrobot.daoexample.model.DiscoverBanner;

/**
 * Created by squall on 2016/5/24.
 */
public class ViewBanner implements Holder<DiscoverBanner> {

    private ImageView imageView;

    @Override
    public View createView(Context context) {
        imageView = (ImageView) View.inflate(context, R.layout.banner_imgitem, null);
        return imageView;
    }

    @Override
    public void UpdateUI(final Context context, final int position, final DiscoverBanner data) {
        ImageLoader.getInstance().displayImage(data.getCover(), imageView, ImageOptions.options);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PushDataHelper.processInnerPushData(context, data.getCode());
            }
        });

    }
}
